<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/4/18
 * Time: 16:00
 */

namespace Home\Controller;


class ContactController extends HomeController
{
    public function index(){
        $meta=array(
            'meta_title'=>C("WEB_SITE_TITLE"),
            'keywords'  =>C("WEB_SITE_KEYWORD"),
            'description'=>C("WEB_SITE_DESCRIPTION"),
            'template_index'=>"Contact/index",
        );
        $this->assign("meta",$meta);
        $this->display();
    }
    public function add(){
        if(IS_AJAX){
            $data=array(
                'name'=>I("post.name","","addslashes"),
                'email'=>I("post.email","","addslashes"),
                'content'=>I("post.content","","addslashes"),
                'create_time'=>time(),
            );
            $contact=M("Contact");
            if($contact->add($data)){
                echo 1;exit;
            }else{
                echo  0;exit;
            }
        }
    }
}